package com.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import com.config.ConfigProperties;

public class JDBCDAOValidation {

	public JDBCDAOValidation() {
	}

	public boolean validaSQLInicial(String sql) {
		try {
			Connection con = new JDBCDAOFactory().conectar(ConfigProperties
					.ler().getProperty("BD_library"));

			PreparedStatement ps = con.prepareStatement(sql);

			ps.executeQuery();
			
		} catch (Exception e) {
			
			System.out.print(e.getMessage());
			return false;			
		}
		
		return true;
	}
	
	public boolean validaMapeamentoMetadataAplication(String sql) {
		try {
			
			Connection con = new JDBCDAOFactory().conectar(ConfigProperties
					.ler().getProperty("BD_library"));

			PreparedStatement ps = con.prepareStatement(sql);

			ps.executeQuery();
			
		} catch (Exception e) {
			System.out.println("\n");
			System.out.print(e.getMessage());
			System.out.println("\n");
			return false;			
		}
		
		return true;
	}
}


